package bb.lanxing.lib.devices.remote;

import android.os.Binder;
import android.os.IBinder;
import android.os.IInterface;
import android.os.Parcel;
import android.os.RemoteException;
//import bb.lanxing.lib.devices.bici.IRemoteBiciController;
import bb.lanxing.lib.devices.ble.cadence.IRemoteSwitchableCadenceController;
import bb.lanxing.lib.devices.ble.heartrate.IRemoteHeartRateBeltController;
import bb.lanxing.lib.devices.ble.x1.IRemoteX1Contraoller;
//import bb.lanxing.lib.devices.sprint.ISprintController;

public interface IRemoteDeviceService extends IInterface {


    public static class Default implements IRemoteDeviceService {
        @Override
        public IBinder asBinder() {
            return null;
        }

        @Override
        public void connect(byte[] bArr) throws RemoteException {
        }

        @Override
        public void disconnect(int i) throws RemoteException {
        }

        @Override
        public void disconnect2(String str) throws RemoteException {
        }

        /*@Override
        public IRemoteBiciController getBiciController(String str) throws RemoteException {
            return null;
        }*/

        @Override
        public IRemoteHeartRateBeltController getHeartRateBeltController(String str) throws RemoteException {
            return null;
        }

        /*@Override
        public ISprintController getSprintController(String str) throws RemoteException {
            return null;
        }*/

        @Override
        public IRemoteSwitchableCadenceController getSwitchableCadenceController(String str) throws RemoteException {
            return null;
        }

        @Override
        public IRemoteX1Contraoller getX1Controller(String str) throws RemoteException {
            return null;
        }

        @Override
        public boolean isConnected(int i) throws RemoteException {
            return false;
        }

        @Override
        public boolean isConnected2(String str) throws RemoteException {
            return false;
        }

        @Override
        public boolean isConnecting(String str) throws RemoteException {
            return false;
        }

        @Override
        public void registerConnectionStateListener(IRemoteConnectionStateListener iRemoteConnectionStateListener) throws RemoteException {
        }

        @Override
        public void release() throws RemoteException {
        }

        @Override
        public void unregisterConnectionStateListener(IRemoteConnectionStateListener iRemoteConnectionStateListener) throws RemoteException {
        }
    }

    void connect(byte[] bArr) throws RemoteException;

    void disconnect(int i) throws RemoteException;

    void disconnect2(String str) throws RemoteException;

//    IRemoteBiciController getBiciController(String str) throws RemoteException;

    IRemoteHeartRateBeltController getHeartRateBeltController(String str) throws RemoteException;

//    ISprintController getSprintController(String str) throws RemoteException;

    IRemoteSwitchableCadenceController getSwitchableCadenceController(String str) throws RemoteException;

    IRemoteX1Contraoller getX1Controller(String str) throws RemoteException;

    boolean isConnected(int i) throws RemoteException;

    boolean isConnected2(String str) throws RemoteException;

    boolean isConnecting(String str) throws RemoteException;

    void registerConnectionStateListener(IRemoteConnectionStateListener iRemoteConnectionStateListener) throws RemoteException;

    void release() throws RemoteException;

    void unregisterConnectionStateListener(IRemoteConnectionStateListener iRemoteConnectionStateListener) throws RemoteException;

    public static abstract class Stub extends Binder implements IRemoteDeviceService {
        private static final String DESCRIPTOR = "bb.lanxing.lib.devices.remote.IRemoteDeviceService";
        static final int TRANSACTION_getX1Controller = 1;
        static final int TRANSACTION_getSprintController = 2;
        static final int TRANSACTION_getBiciController = 3;
        static final int TRANSACTION_getHeartRateBeltController = 4;
        static final int TRANSACTION_getSwitchableCadenceController = 5;
        static final int TRANSACTION_registerConnectionStateListener = 6;
        static final int TRANSACTION_unregisterConnectionStateListener = 7;
        static final int TRANSACTION_connect = 8;
        static final int TRANSACTION_release = 9;
        static final int TRANSACTION_disconnect = 10;
        static final int TRANSACTION_disconnect2 = 11;
        static final int TRANSACTION_isConnected = 12;
        static final int TRANSACTION_isConnected2 = 13;
        static final int TRANSACTION_isConnecting = 14;

        @Override
        public IBinder asBinder() {
            return this;
        }

        public Stub() {
            attachInterface(this, DESCRIPTOR);
        }

        public static IRemoteDeviceService asInterface(IBinder iBinder) {
            if (iBinder == null) {
                return null;
            }
            IInterface queryLocalInterface = iBinder.queryLocalInterface(DESCRIPTOR);
            if ((queryLocalInterface instanceof IRemoteDeviceService)) {
                return (IRemoteDeviceService) queryLocalInterface;
            }
            return new Proxy(iBinder);
        }

        @Override
        public boolean onTransact(int i, Parcel parcel, Parcel parcel2, int i2) throws RemoteException {
            if (i == INTERFACE_TRANSACTION) {
                parcel2.writeString(DESCRIPTOR);
                return true;
            }
            IBinder iBinder = null;
            switch (i) {
                case TRANSACTION_getX1Controller -> {
                    parcel.enforceInterface(DESCRIPTOR);
                    IRemoteX1Contraoller x1Controller = getX1Controller(parcel.readString());
                    parcel2.writeNoException();
                    if (x1Controller != null) {
                        iBinder = x1Controller.asBinder();
                    }
                    parcel2.writeStrongBinder(iBinder);
                    return true;
                }
                /*case TRANSACTION_getSprintController -> {
                    parcel.enforceInterface(DESCRIPTOR);
                    ISprintController sprintController = getSprintController(parcel.readString());
                    parcel2.writeNoException();
                    if (sprintController != null) {
                        iBinder = sprintController.asBinder();
                    }
                    parcel2.writeStrongBinder(iBinder);
                    return true;
                }*/
                /*case TRANSACTION_getBiciController -> {
                    parcel.enforceInterface(DESCRIPTOR);
                    IRemoteBiciController biciController = getBiciController(parcel.readString());
                    parcel2.writeNoException();
                    if (biciController != null) {
                        iBinder = biciController.asBinder();
                    }
                    parcel2.writeStrongBinder(iBinder);
                    return true;
                }*/
                case TRANSACTION_getHeartRateBeltController -> {
                    parcel.enforceInterface(DESCRIPTOR);
                    IRemoteHeartRateBeltController heartRateBeltController = getHeartRateBeltController(parcel.readString());
                    parcel2.writeNoException();
                    if (heartRateBeltController != null) {
                        iBinder = heartRateBeltController.asBinder();
                    }
                    parcel2.writeStrongBinder(iBinder);
                    return true;
                }
                case TRANSACTION_getSwitchableCadenceController -> {
                    parcel.enforceInterface(DESCRIPTOR);
                    IRemoteSwitchableCadenceController switchableCadenceController = getSwitchableCadenceController(parcel.readString());
                    parcel2.writeNoException();
                    if (switchableCadenceController != null) {
                        iBinder = switchableCadenceController.asBinder();
                    }
                    parcel2.writeStrongBinder(iBinder);
                    return true;
                }
                case TRANSACTION_registerConnectionStateListener -> {
                    parcel.enforceInterface(DESCRIPTOR);
                    registerConnectionStateListener(IRemoteConnectionStateListener.Stub.asInterface(parcel.readStrongBinder()));
                    parcel2.writeNoException();
                    return true;
                }
                case TRANSACTION_unregisterConnectionStateListener -> {
                    parcel.enforceInterface(DESCRIPTOR);
                    unregisterConnectionStateListener(IRemoteConnectionStateListener.Stub.asInterface(parcel.readStrongBinder()));
                    parcel2.writeNoException();
                    return true;
                }
                case TRANSACTION_connect -> {
                    parcel.enforceInterface(DESCRIPTOR);
                    connect(parcel.createByteArray());
                    parcel2.writeNoException();
                    return true;
                }
                case TRANSACTION_release -> {
                    parcel.enforceInterface(DESCRIPTOR);
                    release();
                    parcel2.writeNoException();
                    return true;
                }
                case TRANSACTION_disconnect -> {
                    parcel.enforceInterface(DESCRIPTOR);
                    disconnect(parcel.readInt());
                    parcel2.writeNoException();
                    return true;
                }
                case TRANSACTION_disconnect2 -> {
                    parcel.enforceInterface(DESCRIPTOR);
                    disconnect2(parcel.readString());
                    parcel2.writeNoException();
                    return true;
                }
                case TRANSACTION_isConnected -> {
                    parcel.enforceInterface(DESCRIPTOR);
                    boolean isConnected = isConnected(parcel.readInt());
                    parcel2.writeNoException();
                    parcel2.writeInt(isConnected ? 1 : 0);
                    return true;
                }
                case TRANSACTION_isConnected2 -> {
                    parcel.enforceInterface(DESCRIPTOR);
                    boolean isConnected2 = isConnected2(parcel.readString());
                    parcel2.writeNoException();
                    parcel2.writeInt(isConnected2 ? 1 : 0);
                    return true;
                }
                case TRANSACTION_isConnecting -> {
                    parcel.enforceInterface(DESCRIPTOR);
                    boolean isConnecting = isConnecting(parcel.readString());
                    parcel2.writeNoException();
                    parcel2.writeInt(isConnecting ? 1 : 0);
                    return true;
                }
                default -> {
                    return super.onTransact(i, parcel, parcel2, i2);
                }
            }
        }

        public static class Proxy implements IRemoteDeviceService {
            public static IRemoteDeviceService sDefaultImpl;
            private IBinder mRemote;

            public String getInterfaceDescriptor() {
                return Stub.DESCRIPTOR;
            }

            Proxy(IBinder iBinder) {
                this.mRemote = iBinder;
            }

            @Override
            public IBinder asBinder() {
                return this.mRemote;
            }

            @Override
            public IRemoteX1Contraoller getX1Controller(String str) throws RemoteException {
                Parcel obtain = Parcel.obtain();
                Parcel obtain2 = Parcel.obtain();
                try {
                    obtain.writeInterfaceToken(Stub.DESCRIPTOR);
                    obtain.writeString(str);
                    if (!this.mRemote.transact(TRANSACTION_getX1Controller, obtain, obtain2, 0) && Stub.getDefaultImpl() != null) {
                        return Stub.getDefaultImpl().getX1Controller(str);
                    }
                    obtain2.readException();
                    return IRemoteX1Contraoller.Stub.asInterface(obtain2.readStrongBinder());
                } finally {
                    obtain2.recycle();
                    obtain.recycle();
                }
            }

            /*@Override
            public ISprintController getSprintController(String str) throws RemoteException {
                Parcel obtain = Parcel.obtain();
                Parcel obtain2 = Parcel.obtain();
                try {
                    obtain.writeInterfaceToken(Stub.DESCRIPTOR);
                    obtain.writeString(str);
                    if (!this.mRemote.transact(TRANSACTION_getSprintController, obtain, obtain2, 0) && Stub.getDefaultImpl() != null) {
                        return Stub.getDefaultImpl().getSprintController(str);
                    }
                    obtain2.readException();
                    return ISprintController.Stub.asInterface(obtain2.readStrongBinder());
                } finally {
                    obtain2.recycle();
                    obtain.recycle();
                }
            }*/

            /*@Override
            public IRemoteBiciController getBiciController(String str) throws RemoteException {
                Parcel obtain = Parcel.obtain();
                Parcel obtain2 = Parcel.obtain();
                try {
                    obtain.writeInterfaceToken(Stub.DESCRIPTOR);
                    obtain.writeString(str);
                    if (!this.mRemote.transact(TRANSACTION_getBiciController, obtain, obtain2, 0) && Stub.getDefaultImpl() != null) {
                        return Stub.getDefaultImpl().getBiciController(str);
                    }
                    obtain2.readException();
                    return IRemoteBiciController.Stub.asInterface(obtain2.readStrongBinder());
                } finally {
                    obtain2.recycle();
                    obtain.recycle();
                }
            }*/

            @Override
            public IRemoteHeartRateBeltController getHeartRateBeltController(String str) throws RemoteException {
                Parcel obtain = Parcel.obtain();
                Parcel obtain2 = Parcel.obtain();
                try {
                    obtain.writeInterfaceToken(Stub.DESCRIPTOR);
                    obtain.writeString(str);
                    if (!this.mRemote.transact(TRANSACTION_getHeartRateBeltController, obtain, obtain2, 0) && Stub.getDefaultImpl() != null) {
                        return Stub.getDefaultImpl().getHeartRateBeltController(str);
                    }
                    obtain2.readException();
                    return IRemoteHeartRateBeltController.Stub.asInterface(obtain2.readStrongBinder());
                } finally {
                    obtain2.recycle();
                    obtain.recycle();
                }
            }

            @Override
            public IRemoteSwitchableCadenceController getSwitchableCadenceController(String str) throws RemoteException {
                Parcel obtain = Parcel.obtain();
                Parcel obtain2 = Parcel.obtain();
                try {
                    obtain.writeInterfaceToken(Stub.DESCRIPTOR);
                    obtain.writeString(str);
                    if (!this.mRemote.transact(TRANSACTION_getSwitchableCadenceController, obtain, obtain2, 0) && Stub.getDefaultImpl() != null) {
                        return Stub.getDefaultImpl().getSwitchableCadenceController(str);
                    }
                    obtain2.readException();
                    return IRemoteSwitchableCadenceController.Stub.asInterface(obtain2.readStrongBinder());
                } finally {
                    obtain2.recycle();
                    obtain.recycle();
                }
            }

            @Override
            public void registerConnectionStateListener(IRemoteConnectionStateListener iRemoteConnectionStateListener) throws RemoteException {
                Parcel obtain = Parcel.obtain();
                Parcel obtain2 = Parcel.obtain();
                try {
                    obtain.writeInterfaceToken(Stub.DESCRIPTOR);
                    obtain.writeStrongBinder(iRemoteConnectionStateListener != null ? iRemoteConnectionStateListener.asBinder() : null);
                    if (!this.mRemote.transact(TRANSACTION_registerConnectionStateListener, obtain, obtain2, 0) && Stub.getDefaultImpl() != null) {
                        Stub.getDefaultImpl().registerConnectionStateListener(iRemoteConnectionStateListener);
                    } else {
                        obtain2.readException();
                    }
                } finally {
                    obtain2.recycle();
                    obtain.recycle();
                }
            }

            @Override
            public void unregisterConnectionStateListener(IRemoteConnectionStateListener iRemoteConnectionStateListener) throws RemoteException {
                Parcel obtain = Parcel.obtain();
                Parcel obtain2 = Parcel.obtain();
                try {
                    obtain.writeInterfaceToken(Stub.DESCRIPTOR);
                    obtain.writeStrongBinder(iRemoteConnectionStateListener != null ? iRemoteConnectionStateListener.asBinder() : null);
                    if (!this.mRemote.transact(TRANSACTION_unregisterConnectionStateListener, obtain, obtain2, 0) && Stub.getDefaultImpl() != null) {
                        Stub.getDefaultImpl().unregisterConnectionStateListener(iRemoteConnectionStateListener);
                    } else {
                        obtain2.readException();
                    }
                } finally {
                    obtain2.recycle();
                    obtain.recycle();
                }
            }

            @Override
            public void connect(byte[] bArr) throws RemoteException {
                Parcel obtain = Parcel.obtain();
                Parcel obtain2 = Parcel.obtain();
                try {
                    obtain.writeInterfaceToken(Stub.DESCRIPTOR);
                    obtain.writeByteArray(bArr);
                    if (!this.mRemote.transact(TRANSACTION_connect, obtain, obtain2, 0) && Stub.getDefaultImpl() != null) {
                        Stub.getDefaultImpl().connect(bArr);
                    } else {
                        obtain2.readException();
                    }
                } finally {
                    obtain2.recycle();
                    obtain.recycle();
                }
            }

            @Override
            public void release() throws RemoteException {
                Parcel obtain = Parcel.obtain();
                Parcel obtain2 = Parcel.obtain();
                try {
                    obtain.writeInterfaceToken(Stub.DESCRIPTOR);
                    if (!this.mRemote.transact(TRANSACTION_release, obtain, obtain2, 0) && Stub.getDefaultImpl() != null) {
                        Stub.getDefaultImpl().release();
                    } else {
                        obtain2.readException();
                    }
                } finally {
                    obtain2.recycle();
                    obtain.recycle();
                }
            }

            @Override
            public void disconnect(int i) throws RemoteException {
                Parcel obtain = Parcel.obtain();
                Parcel obtain2 = Parcel.obtain();
                try {
                    obtain.writeInterfaceToken(Stub.DESCRIPTOR);
                    obtain.writeInt(i);
                    if (!this.mRemote.transact(TRANSACTION_disconnect, obtain, obtain2, 0) && Stub.getDefaultImpl() != null) {
                        Stub.getDefaultImpl().disconnect(i);
                    } else {
                        obtain2.readException();
                    }
                } finally {
                    obtain2.recycle();
                    obtain.recycle();
                }
            }

            @Override
            public void disconnect2(String str) throws RemoteException {
                Parcel obtain = Parcel.obtain();
                Parcel obtain2 = Parcel.obtain();
                try {
                    obtain.writeInterfaceToken(Stub.DESCRIPTOR);
                    obtain.writeString(str);
                    if (!this.mRemote.transact(TRANSACTION_disconnect2, obtain, obtain2, 0) && Stub.getDefaultImpl() != null) {
                        Stub.getDefaultImpl().disconnect2(str);
                    } else {
                        obtain2.readException();
                    }
                } finally {
                    obtain2.recycle();
                    obtain.recycle();
                }
            }

            @Override
            public boolean isConnected(int i) throws RemoteException {
                Parcel obtain = Parcel.obtain();
                Parcel obtain2 = Parcel.obtain();
                try {
                    obtain.writeInterfaceToken(Stub.DESCRIPTOR);
                    obtain.writeInt(i);
                    boolean z = false;
                    if (!this.mRemote.transact(TRANSACTION_isConnected, obtain, obtain2, 0) && Stub.getDefaultImpl() != null) {
                        return Stub.getDefaultImpl().isConnected(i);
                    }
                    obtain2.readException();
                    if (obtain2.readInt() != 0) {
                        z = true;
                    }
                    return z;
                } finally {
                    obtain2.recycle();
                    obtain.recycle();
                }
            }

            @Override
            public boolean isConnected2(String str) throws RemoteException {
                Parcel obtain = Parcel.obtain();
                Parcel obtain2 = Parcel.obtain();
                try {
                    obtain.writeInterfaceToken(Stub.DESCRIPTOR);
                    obtain.writeString(str);
                    boolean z = false;
                    if (!this.mRemote.transact(TRANSACTION_isConnected2, obtain, obtain2, 0) && Stub.getDefaultImpl() != null) {
                        return Stub.getDefaultImpl().isConnected2(str);
                    }
                    obtain2.readException();
                    if (obtain2.readInt() != 0) {
                        z = true;
                    }
                    return z;
                } finally {
                    obtain2.recycle();
                    obtain.recycle();
                }
            }

            @Override
            public boolean isConnecting(String str) throws RemoteException {
                Parcel obtain = Parcel.obtain();
                Parcel obtain2 = Parcel.obtain();
                try {
                    obtain.writeInterfaceToken(Stub.DESCRIPTOR);
                    obtain.writeString(str);
                    boolean z = false;
                    if (!this.mRemote.transact(TRANSACTION_isConnecting, obtain, obtain2, 0) && Stub.getDefaultImpl() != null) {
                        return Stub.getDefaultImpl().isConnecting(str);
                    }
                    obtain2.readException();
                    if (obtain2.readInt() != 0) {
                        z = true;
                    }
                    return z;
                } finally {
                    obtain2.recycle();
                    obtain.recycle();
                }
            }
        }

        public static boolean setDefaultImpl(IRemoteDeviceService iRemoteDeviceService) {
            if (Proxy.sDefaultImpl == null) {
                if (iRemoteDeviceService == null) {
                    return false;
                }
                Proxy.sDefaultImpl = iRemoteDeviceService;
                return true;
            }
            throw new IllegalStateException("setDefaultImpl() called twice");
        }

        public static IRemoteDeviceService getDefaultImpl() {
            return Proxy.sDefaultImpl;
        }
    }
}
